Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Fix invalid writes and increase robustness #1611

Merged

Conversation

tveasey
Copy link
Contributor

@tveasey tveasey commented Dec 4, 2020

This primarily fixes two potential edge cases leading to invalid writes:

  1. We weren't checking that the time supplied to shiftTime for the expanding window was after the start of the window. This led to unsigned integer underflow and bad arguments supplied to std::fill. This could very occasionally happen.
  2. We were wrongly indexing the seasonal hypothesis vector if some of them weren't testable. This could lead to an invalid write.

As part of tracking down these memory corruptions, I also audited potentially dangerous places in the code. These were safe, but relied on rather delicate invariants or inputs being correct. I've tightened up the logic to ensure that these assumptions are now checked.

This is unreleased code so marking as a non-issue.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Feel free to leave the suggestion for a subsequent PR if you want to get this merged sooner

lib/maths/CTimeSeriesTestForSeasonality.cc Show resolved Hide resolved
@tveasey tveasey merged commit 2eae811 into elastic:long-bucket-modelling-improvements Dec 7, 2020
@tveasey tveasey deleted the robustness branch December 7, 2020 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants